/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package carreras.ganador.test;

import java.util.ArrayList;

/**
 *
 * @author Fanky10 <fanky10@gmail.com>
 */
public class Competencia extends ArrayList<Carrera> {
    public static void main(String args[]){
        Competencia comp = new Competencia();
        Carrera car = new Carrera();
        Carril c = new Carril(1,true);
        car.add(c);
        c = new Carril(2,false);
        car.add(c);
        comp.add(car);
        print_result(comp);
        System.out.println("filtrando perdedores...");
        filtra_perdedores(comp);
        System.out.println("Solo ganadores!");
        print_result(comp);
    }
    private static void print_result(Competencia comp){
        for(Carrera car: comp){
            for(Carril c: car){
                System.out.println("carril: "+c.toString());
            }
        }
    }
    //it works!!
    private static void filtra_perdedores(Competencia comp){
        //it works
        //begin
//        for(Carrera car: comp){
//            for(Carril c: car){
//                if(c.isEs_perdedor())
//                    car.remove(c);
//            }
//        }//end
        for(Carrera car: comp){
            car.elimina_perdedor();
        }
        
    }
    
    
    
}
